class code5 {
    public int reverse(int x) {
        long ret = 0;
        while(x!=0) {
            ret = (ret*10 + x%10);
            x/=10;
        }
        return (int)ret==ret ? (int)ret:0;
    }
}